﻿@{
    Bundle("jquery_validate");
}

<script type="text/javascript">
    jQuery(document).ready(function () {
        jQuery('@ID("#form_cfg")').validate({
            rules: {
                historySize: {
                    required: true,
                    range: [0, 50]
                }
            }
        });
        jQuery.ajax({
            type: 'post',
            url: '@Url.Action(Loc.Act("Locales").Ctrl("Configuration"))',
            dataType: 'json',
            success: function (rsp) {
                var ddl = jQuery('@ID("#ddl_locale")');
                ddl.empty();
                jQuery.each(rsp, function (k, v) {
                    ddl.append('<option value=' + v.id + '>' + v.value + '</option>');
                });
                ddl.val('@JDM.Int32(Svc.Account.LocalizationProfile.EntityID)');
            }
        });
    });
</script>
<form class="common-form" id="@ID("form_cfg")" action="@Url.Action(Loc.Act("Preferences").Localized())" method="post">
    <table>
        <tr>
            <td>
                <label>@T(Res.Name("LocalizationProfile"))</label>
            </td>
            <td>
                <select id="@ID("ddl_locale")" name="localizationProfileID"></select>
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.Name("HistorySize"))</label>
            </td>
            <td>
                <input type="text" name="historySize" value="@Svc.Attribute(Par.In("WebPortal").Of("Preferences").Name("HistorySize"), 15)" />
            </td>
        </tr>
    </table>
    <ul class="bar toolbar">
        <li><input class="button" type="submit" value="@T(Res.In("Common").Of("Act").Name("Submit"))" /></li>
    </ul>
</form>
